package com.zsx.shopping.ware.controller;

import com.zsx.shopping.common.api.R;
import com.zsx.shopping.common.api.ware.dto.LockStockDto;
import com.zsx.shopping.ware.service.OrderStockTaskService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/ware/orderStockTask")
public class OrderStockTaskController {

    @Resource
    private OrderStockTaskService orderStockTaskService;

    @PutMapping("/lockStock")
    public R<Void> lockStock(@RequestBody LockStockDto lockStockDto) {
        orderStockTaskService.lockStock(lockStockDto);
        return R.success();
    }

    @PutMapping("/reduceStock")
    public R<Void> reduceStock(@RequestParam Long orderId) {
        orderStockTaskService.reduceStock(orderId);
        return R.success();
    }
}
